home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The 640 MEG Shareware Studio 5
/
The 640 Meg Shareware Studio CD-ROM Volume V (Data Express)(1994).ISO
/
amiga
/
tdemo2.lha
/
ProgrammersInfo
/
DSKEL-FR.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-06-05
|
3KB
|
172 lines
// SKEL-FAKE v1.0
// (FAKE REPORTER)
//**********************
//***** Includes *****
//**********************
#include <proto/all.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <tempest/headers.h>
//********************************
//***** Structures/Defines *****
//********************************
struct MyMessage
{
struct Message Msg; // for Exec message routines
ULONG Command; // Command to be executed.
char *text1,
*text2,
*text3;
int Value1,
Value2;
ULONG LongValue;
LONGBITS Flags;
int carrier;
struct User *User;
struct SystemData *SystemData;
struct NodeData *NodeData;
struct Today *Today;
};
struct MyMessage send;
struct User *User;
struct MsgPort *MyPort = NULL;
struct MyMessage *msg;
int DoorStart(TEXT *);
int DOORIO(VOID);
VOID CloseStuff(VOID);
VOID pl(TEXT *);
VOID input(TEXT *,int);
char MyName[60],st[60];
//******************
//***** Main *****
//******************
VOID main(int argc,char *argv[])
{
char string1[255],string2[255];
register int fd;
if(!DoorStart(argv[1])) { PutStr("[os2] Tempest Door\n"); exit(0); }
pl("\f
[
DSKEL-FR v3.15
]
Fake Reporter By Michael Bockert
[
05-24-94
]\r\n");
pl("
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n");
CONTINUE:
pl("
[
Q = Quit
]
Enter Filename of Fake:
");
input(string1,12);
if(string1[0] == ' ')
CloseStuff();
if(string1[1] == NULL)
if((string1[0] == 'q') || (string1[0] == 'Q'))
CloseStuff();
strcpy(string2,"FAKES:");
strcat(string2,string1);
fd=Open(string2,MODE_NEWFILE);
Close(fd);
goto CONTINUE;
}
//************************
//***** Door Start ***** // MUST BE INCLUDED IN ALL DOORS!
//************************
int DoorStart(TEXT *node)
{
struct MsgPort *HisPort;
send.carrier=0;
sprintf(st,"%s:TEMPEST_DOOR",node);
HisPort = FindPort(st);
if(HisPort==NULL) return (FALSE);
sprintf(MyName,"%s:DOOR_PORT",node);
MyPort = CreatePort(MyName,0L);
if(MyPort==NULL)
{
PutStr("Cant open port");
return(int)FALSE;
}
DOORIO();
User=*&send.User;
return (int)TRUE;
}
//********************
//***** DoorIO ***** // MUST BE INCLUDED IN ALL DOORS!
//********************
int DOORIO(VOID)
{
struct MsgPort *HisPort;
if(send.carrier) return(0);
HisPort = FindPort(st);
if(HisPort!=NULL)
{
send.Msg.mn_Node.ln_Type = NT_MESSAGE;
send.Msg.mn_Length = sizeof(send);
send.Msg.mn_ReplyPort = MyPort;
send.carrier=0;
PutMsg((struct MsgPort *)HisPort,(struct Message *)&send);
Wait(1 << MyPort->mp_SigBit);
GetMsg(MyPort);
if(send.carrier) CloseStuff();
return(1);
}
return(0);
}
//*************************
//***** Close Stuff ***** // MUST BE INCLUDED IN ALL DOORS!
//*************************
VOID CloseStuff(VOID)
{
send.Command=999;
DOORIO();
while(msg=(struct MyMessage *)GetMsg(MyPort)) ReplyMsg((struct Message *)msg);
if(MyPort) DeletePort(MyPort);
exit(0);
}
//*******************
//***** Input ***** // Command 20
//*******************
VOID input(TEXT *mstring,int len)
{
send.Command=20;
send.Value1=len;
send.text1 =mstring;
DOORIO();
}
//*****************************
//***** PL (Print Line) ***** // Command 1
//*****************************
VOID pl(TEXT *string)
{
send.Command=1;
send.text1=string;
DOORIO();
}